<?php

function smarty_function_load_object_page($params, $smarty) {

    $myfile = $params['filename'] . ".php";
    require_once PRESENTATION_DIR . $myfile;

    $className = str_replace(' ', '', ucfirst(str_replace('_', ' ', $params['filename'])));

    // Create presentation object
    $obj = new $className();

    if (method_exists($obj, 'init')) {
        $obj->init();
    }

    // Assign template variable
    $smarty->assign($params['assign'], $obj);
}

?>
